<!doctype html>
<html>			
				<head>
					<script type="text/javascript" src="../js/order.js">
					</script>
					<script type="text/javascript" src="../js/jq.js">
					</script>
					<script type="text/javascript" src="../js/slide.js">
					</script>
					<script type="text/javascript">
						
    function suggest(inputString){
                if(inputString.length == 0) {
                        $('#suggestions').fadeOut();
                } else {
                $('#customer').addClass('load');
                        $.post("autosuggest.php?act=cust", {queryString: ""+inputString+""}, function(data){
                                if(data.length >0) {
                                        $('#suggestions').fadeIn();
                                        $('#suggestionsList').html(data);
                                        $('#customer').removeClass('load');
                                }
                        });
                }
        }
 //09322256826
        function fill(thisValue) {
                $('#customer').val(thisValue);
                setTimeout("$('#suggestions').fadeOut();", 600);
        }
 

					</script>
					<script type="text/javascript">
						
$(function(){
 
$('input[id^=qty]').keyup(function(){
 
    var parentDiv = $(this).closest('#axd');
       
    var curprice=parentDiv.find('input[id^=price]').val();
    var curqty= this.value;
    var curtotal=curprice * curqty;
 
    parentDiv.find('input[id^=comp]').val(curtotal);
});
 
});
 					</script>
					<script type="text/javascript">
						
 
 
function check_empty(field, alerttxt)
{
with(field)
{
         if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
}
 
}
 
function validate_form(thisform)
{
with (thisform)
  {
         
 
                if (check_empty(ini_pay,"Please fill out initial payment!")==false)
    {ini_pay.focus();return false;}
        if (check_empty(transdesc,"Please fill out the Description!")==false)
    {description.focus();return false;}
  if (check_empty(customer,"Please fill out the Customer!")==false)
    {supplier.focus();return false;}
 
        if (check_empty(qbuys[], "Please fill out the quantities!")==false)
    {qbuys[].focus();return false;}
 
               
  }
}

					</script>
					<script>
						
shortcut.add("F2",function() {
        window.location ="store.php"
});
 
shortcut.add("left",function() {
        history.go(-1)
});
 
shortcut.add("right",function() {
        history.go(+1)
});
 

					</script>
				</head>
				<body>

							<div>
								<table border="1">
									<tr>
										<th>
											Product
										</th>
										<th>
											Qtyhand
										</th>
										<th>
											QtySell
										</th>
										<th>
											Sell Price
										</th>
										<th>
											Subtotal
										</th>
										<th>
											Remove
										</th>
										<!-- <th>Discount</th> -->
										<!--commented out on jan 19 -->
										<!-- <th>Subtotal</th> -->
										<!--commented out on jan 21-->
									</tr>
								
										<tr>
											<form name="cartform" method="get" onsubmit="return validate_form(this);" action="checkout.php">
												<div id="axd">
													<td>
														<?php echo $name; ?>
													</td>
													<input type="hidden" id="pids" name="ids[]" value="<?php echo
													$id; ?>"/>
													<input type="hidden" name="qoh[]" value="<?php echo
													$qtyhand; ?>"/>
													<input type="hidden" name="dprice[]" value="<?php echo
													$dsprice; ?>"/>
													<td>
														<?php echo $qtyhand; ?>
													</td>
													<td>
														<input type="text" id="<?php echo
														'qty' . $id; ?>" name="qbuys[]" value=""/>
													</td>
													<input type="hidden" id="<?php echo
													'price' . $id; ?>" name="sprice[]" value="<?php echo
													$ssprice; ?>"/>
													<td>
														<?php echo $ssprice; ?>
													</td>
													<td>
														<input type="text" name="subtot[]" id="<?php echo
														'comp' . $id; ?>" value=""/>
													</td>
													<td>
														<a href="viewcart.php?action=zeroline&id=<?php echo
														$id; ?>"><img src="../img/system/delete-icon.png" /></a>
													</td>
													<!-- <td><input type="text" name="disc[]"  value=""></td> -->
												</div>
											</form>
										</tr>

								</table>
							</div>
							<table>
								<tr>
									<td>
										*Description:
										<input type="text" name="transdesc" id="transdesc" class="midrange" value="" />
									</td>
								</tr>
							</table>
							<!-- <table>
							<tr>
							<td>
							Discount all:<input type="text" name="discountall" id="discountall" class="midrange" value="">  
							</td> 
							</tr> 
							</table>
							-->
							<!--commented out on jan 19 -->
							<table>
								<tr>
									<td>
										<div>
											*Customer:
											<input type="text" name="customer" id="customer" onkeyup="suggest(this.value)" value="" autocomplete="off" />
											<a href="regcustomer.php"><input type="submit" value="Add Customer" /></a>
											<div class="suggestionsBox" id="suggestions" style="display: none;">
												<div class="suggestionList" id="suggestionsList">
													&nbsp;
												</div>
											</div>
										</div>
									</td>
								</tr>
							</table>
							<!-- commented out jan 21 <table>
							<tr>
							<td>
							Total:
							<input type="text" name="order_total" class="midrange" id="order_total" value="">
							</td> 
							</tr> 
							</table>
							-->
							<table>
								<tr>
									<td>
										*Initial Pay:
										<input type="text" name="ini_pay" class="midrange" id="ini_pay" value="">
									</td>
								</tr>
							</table>
							<table>
								<tr>
									<td>
										<a href='store.php'><input type='submit' value='Back'></a>
										<input type='submit' onclick="return confirm('Are you sure?')" value='Sell'>
										</a>
									</td>
								</tr>
								</form>
							</table>

				</body>
				
				</html>